﻿using QuickDial_5_0.Controller;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace QuickDial_5_0.View.Default
{
    public partial class FrmItemEdit : Form
    {
        FrmItemEditController controller;
        ItemObject item;
        public int KeyID { get; set; }
        public FrmItemEdit()
        {
            InitializeComponent();
        }

        private void FrmItemEdit_Load(object sender, EventArgs e)
        {
            this.controller = new FrmItemEditController(this);
            this.Frm_Reload();
        }
        public void Frm_Reload()
        {
            //cbb_tag_picker.DataSource = this.controller.GetTags();
            if (this.KeyID > 0)
            {
                this.item = this.controller.GetItemById(KeyID);
                this.Text = "编辑 " + this.item.Name;
                tb_name.Text = this.item.Name;
                tb_path.Text = this.item.Path;
                tb_remark.Text = this.item.Remark;
                tb_tags.Text = this.item.Tags;
            }
            else
            {
                this.Text = "添加图标";
                tb_name.ResetText();
                tb_path.ResetText();
                tb_remark.ResetText();
                tb_tags.ResetText();     
            }
        }
    }
}
